import java.util.Scanner;

public class Test2_5 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        // 提示用户输入
        System.out.println("Enter the subtotal and a gratuity rate:");
        // 用户需要按顺序输入，否则后面的计算会出错
        double subtotal = input.nextDouble();
        double rate = input.nextDouble();
        // 计算小费
        double gratuity = subtotal * rate / 100;
        // 计算总费用
        double total = subtotal + gratuity;
        // 输出结果
        System.out.println("The gratuity is $" +gratuity + " and total is $" + total);
    }
}
